using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Gate : MonoBehaviour
{
    public ParameterPlayer parameterPlayerCopy = new ParameterPlayer();
    private Collider2D coll;
    public GameObject player;
    public GameObject DontDestory;
    public GameObject imformation;
    // Start is called before the first frame update
    void Start()
    {
        coll = GetComponent<Collider2D>();
    }

    // Update is called once per frame
    void Update()
    {
        player = GameObject.FindWithTag("Player");
        if (coll.IsTouchingLayers(LayerMask.GetMask("Player")))
        {
            imformation.SetActive(true);
            if (Input.GetKeyDown(KeyCode.E))
            {
                DontDestroyOnLoad(DontDestory);
                DontDestroyOnLoad(GameObject.Find("ObjectPool"));
                SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
            }
        }
        else
        {
            imformation.SetActive(false);
        }
        if (SceneManager.GetActiveScene().buildIndex == 5)
        {
            transform.position = new Vector3(100, 100, 0);
        }
    }
}
